home *** CD-ROM | disk | FTP | other *** search
- ;NEWBELL 2-24-83 by Jim Keesey, 2945 Sandra Pl., Palo Alto, CA 94303
- ; changes 2-25-83 by J. R. Celoni, S.J.
- ; <CSL.JLH.Celoni@SU-SCORE.ARPA>
- ;Run after boot to change DOS (not Basic) bell tone and length.
-
- note_length equ 09a00h ;length (ms) * 131.072
- note equ 0a98h ;2712 = 1193180. / 440Hz
-
- cseg segment public 'code'
- assume cs:cseg,ds:cseg
- org 100h
- start proc far
- jmp initial
- start endp
-
- even
- video_io dd 0
-
- new_bell proc near
- sti ;enable
- cmp ah,0eh ;tty mode
- jz nb1 ;yes
- vid: jmp cs:video_io ;goto rom
- nb1: cmp al,7 ;bell
- jnz vid ;no, let rom do it
-
- ;see IBM Tech. Ref. Man. p. A-18: BEEP & ERR_BEEP
- ;
- cli ;MUST disable
- mov al,0b6h ;sel tim 2,lsb,msb,binary
- out 43h,al ;set up timer chip
- mov ax,note ;get note
- out 42h,al ;write timer 2 count: lsb...
- mov al,ah
- out 42h,al ;...and msb
- in al,61h
- mov ah,al ;save current port setting
- or al,3
- out 61h,al ;turn spkr on
- mov cx,note_length ;64K = 500 ms
- here: loop here ;delay
- mov al,ah
- out 61h,al ;restore port setting
- sti ;enable
- iret
- new_bell endp
-
- initial proc near
- cli
- xor ax,ax
- mov ds,ax ;address interrupts
- mov si,40h ;int 10h: video_io
- lea di,video_io
- mov cx,2
- rep movsw ;save old trap loc
- mov si,40h ;int 10h
- lea ax,new_bell
- mov word ptr [si],ax ;store new trap loc...
- mov word ptr [si+2],cs ;...& code seg
- lea dx,initial
- inc dx ;one past last byte needed
- int 27h ;terminate & stay resident
- initial endp
-
- cseg ends
- end start